package com.miukoo.aikao.qpaper.dto.response;

import com.miukoo.aikao.qpaper.dto.PaperDto;
import com.miukoo.aikao.qpaper.dto.PaperQuestionDto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

import java.util.Calendar;
import java.util.List;

@Setter
@Getter
@ApiModel(value="考试详情", description="考试详情")
public class ExamDetailRespDto extends PaperDto {


    @ApiModelProperty(value = "单选题列表", required=true)
    private List<PaperQuestionDto> radioList;

    @ApiModelProperty(value = "多选题列表", required=true)
    private List<PaperQuestionDto> multiList;

    @ApiModelProperty(value = "判断题", required=true)
    private List<PaperQuestionDto> judgeList;

    @ApiModelProperty(value = "问答题", required=true)
    private List<PaperQuestionDto> qaList;

    @ApiModelProperty(value = "编程题", required=true)
    private List<PaperQuestionDto> codingList;


    @ApiModelProperty(value = "剩余结束秒数", required=true)
    public Long getLeftSeconds(){

        // 结束时间
        Calendar cl = Calendar.getInstance();
        cl.setTime(this.getCreateTime());
        cl.add(Calendar.MINUTE, getTotalTime());

        return (cl.getTimeInMillis() - System.currentTimeMillis()) / 1000;
    }

}
